#include <iostream>
#include <fstream>
#include <string>

int main() 
{
    std::ifstream ifs("src.txt", std::ios::in);
    std::ofstream ofs("dest.txt", std::ios::out | std::ios::trunc);

    if (!ifs) 
    {
        std::cerr << "Error opening source file for reading." << std::endl;
        return 1;
    }

    if (!ofs) 
    {
        std::cerr << "Error opening destination file for writing." << std::endl;
        return 1;
    }

    std::string line;
    while (std::getline(ifs, line)) 
    {
        ofs << line << std::endl;
    }

    ifs.close();
    ofs.close();

    std::cout << "File copied successfully!" << std::endl;
    return 0;
}